package com.xpsoft.oa.dao.produce.impl;


import java.util.List;

import org.hibernate.Query;

import com.xpsoft.core.dao.impl.BaseDaoImpl;
import com.xpsoft.oa.dao.produce.MaterialAllocationInfoDao;
import com.xpsoft.oa.model.produce.MaterialAllocationInfo;

public class MaterialAllocationInfoDaoImpl extends BaseDaoImpl<MaterialAllocationInfo> implements MaterialAllocationInfoDao{

	public MaterialAllocationInfoDaoImpl() {
		super(MaterialAllocationInfo.class);
	}

	@Override
	public void deleteMaterialAllocationInfos(Long allocationId,
			List<Long> idList) {
		// TODO Auto-generated method stub
		String hql = "delete from MaterialAllocationInfo where id not in (:ids) and materialAllocation.id=:allocationId";
		Query query =  getSession().createQuery(hql);
		query.setParameterList("ids", idList).setParameter("allocationId", allocationId);
		query.executeUpdate();
	}

}